﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Yhdistelija
{
    public partial class MainWindow : Window
    {
        FileJoiner joiner = new FileJoiner();

        public MainWindow()
        {
            InitializeComponent();

            joiner.SourcePath = "C:\\";
            joiner.TargetPath = "C:\\";

            this.DataContext = joiner;
        }

        private void btnFindFiles_Click(object sender, RoutedEventArgs e)
        {
            try {
                statusText.Text = "";
                joiner.FindFiles();
            }
            catch (Exception ex) {
                statusText.Text = ex.Message;
            }
        }

        private void btnJoinFiles_Click(object sender, RoutedEventArgs e)
        {
            try {
                statusText.Text = "";
                joiner.JoinFiles(lstSourceFiles.SelectedItems.Cast<string>());
            }
            catch (Exception ex) {
                statusText.Text = ex.Message;
            }
        }
    }
}
